package com.campus.mapper;

import com.campus.pojo.po.Subject;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SubjectMapper {

    @Select("select id,name,type_id from subject")
    List<Subject> getAllSubjects();

    /**
     * 通过id删除学科
     * @param id
     */
    @Delete("delete from subject where id = #{id}")
    void deleteSubjectById(Integer id);

    /**
     * 添加学科
     * @param subject
     */
    void addSubject(Subject subject);

    /**
     * 检查学科是否存在
     * @param name
     * @return
     */

    Integer checkExist(@Param("name") String name);

    void updateSubject(Subject subject);
}
